﻿<%@ Page Language="C#" MasterPageFile="~/Delivery.master" AutoEventWireup="true" CodeFile="frmPedido.aspx.cs" Inherits="Procesos_frmPedidos" Title="Gestión de Pedidos" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
            height: 32px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Contenido" Runat="Server">
    <table cellpadding="2" class="style1">
        <tr>
            <td class="style2">
                <asp:Label ID="lblNumero" runat="server" Text="Nº"></asp:Label>
                &nbsp;<asp:DropDownList ID="ddlLetra" runat="server" Height="23px" Width="45px">
                </asp:DropDownList>
                <asp:TextBox ID="txtPuntoVenta" runat="server" Width="45px"></asp:TextBox>
                <asp:Label ID="lbl" runat="server" Text="-"></asp:Label>
                <asp:TextBox ID="txtNumero" runat="server" Width="108px"></asp:TextBox>
            </td>
            <td align="right" class="style2">
                <asp:Label ID="lblFechaEmision" runat="server" Text="Fecha Emision"></asp:Label>
                &nbsp;<asp:TextBox ID="txtFechaEmision" runat="server" Width="92px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <table cellpadding="2" class="style1">
                    <tr>
                        <td>
                            <asp:Label ID="lblCliente" runat="server" Text="Cliente:"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlCliente" runat="server" Height="23px" Width="270px" 
                                AutoPostBack="True" onselectedindexchanged="ddlCliente_SelectedIndexChanged">
                            </asp:DropDownList>
                        </td>
                        <td>
                <asp:Label ID="lblTelefono" runat="server" Text="Telefono:"></asp:Label>
                        </td>
                        <td>
                <asp:TextBox ID="txtTelefono" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                <asp:Label ID="lblDireccion" runat="server" Text="Dirección:"></asp:Label>
                        </td>
                        <td colspan="3">
                <asp:TextBox ID="txtDireccion" runat="server" Width="509px"></asp:TextBox>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <table cellpadding="2" class="style1">
                    <tr>
                        <td>
                <asp:Label ID="lblArticulo" runat="server" Text="Articulo:"></asp:Label>
                        </td>
                        <td>
                <asp:DropDownList ID="ddlArticulo" runat="server" Height="23px" Width="189px" 
                                AutoPostBack="True" onselectedindexchanged="ddlArticulo_SelectedIndexChanged">
                </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                <asp:Label ID="lblPrecioUnitario" runat="server" Text="Precio:"></asp:Label>
                        </td>
                        <td>
                <asp:TextBox ID="txtPrecio" runat="server" Enabled="False"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                <asp:Label ID="lblCantidad" runat="server" Text="Cantidad:"></asp:Label>
                        </td>
                        <td>
                <asp:TextBox ID="txtCantidad" runat="server" AutoPostBack="True" 
                                ontextchanged="txtCantidad_TextChanged"></asp:TextBox>
                <asp:RangeValidator ID="rvCantidad" runat="server" 
                    ControlToValidate="txtCantidad" Display="Dynamic" 
                    ErrorMessage="La cantidad debe ser mayor a cero" MaximumValue="100" MinimumValue="1">*</asp:RangeValidator>
                <asp:RequiredFieldValidator ID="rfvCantidad" runat="server" 
                    ControlToValidate="txtCantidad" Display="Dynamic" 
                    ErrorMessage="Campo requerido para cantidad">*</asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>
                <asp:Label ID="lblSubTotal" runat="server" Text="Sub-Total:"></asp:Label>
                        </td>
                        <td>
                <asp:TextBox ID="txtSubTotal" runat="server" Enabled="False"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" colspan="2">
                <asp:Button ID="butAgregar" runat="server" Text="Agregar" BorderStyle="None" 
                CausesValidation="False" onclick="butAgregar_Click" />
                        </td>
                    </tr>
                </table>
                <asp:ValidationSummary ID="vsArticulo" runat="server" Width="296px" />
            </td>
            <td>
                <asp:GridView ID="grvDatos" runat="server" AllowPaging="True" 
                    AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" 
                    GridLines="None" PageSize="5" 
                    onselectedindexchanged="grvDatos_SelectedIndexChanged" 
                    onpageindexchanged="grvDatos_PageIndexChanged">
                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    <Columns>
                        <asp:BoundField DataField="Articulo" HeaderText="Articulo" 
                            SortExpression="Articulo" />
                        <asp:BoundField DataField="Cantidad" HeaderText="Cantidad" 
                            SortExpression="Cantidad" />
                        <asp:BoundField DataField="Precio" HeaderText="Precio" 
                            SortExpression="Precio" DataFormatString="{0:c}" />
                        <asp:CommandField ShowDeleteButton="True" />
                    </Columns>
                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#999999" />
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                </asp:GridView>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="lblObservacion" runat="server" Text="Observación"></asp:Label>
                <br />
                <asp:TextBox ID="txtObservacion" runat="server" TextMode="MultiLine" 
                    Width="294px"></asp:TextBox>
            </td>
            <td align="right">
                <asp:Label ID="lblTotal" runat="server" Text="Total:"></asp:Label>
                &nbsp;<asp:Label ID="labelTotal" runat="server" Text="$0" ForeColor="#336699"></asp:Label>
            </td>
        </tr>
        <tr>
            <td align="right" colspan="2">
                <asp:Button ID="butGuardar" runat="server" Text="Guardar" 
                onclick="butGuardar_Click" BorderStyle="None" />
            </td>
        </tr>
    </table>
</asp:Content>

